package leetcode;

public class sousuocharuweizhi {
    public static int searchInsert(int[] nums, int target) {
        int left=0;
        int right=nums.length-1;
        while(left<right){
            int mid=left+(right-left)/2;
            if(nums[mid]>=target){
                right=mid;
            }else{
                left=mid+1;
            }
        }
        return nums[left]==target?left:left+1;

    }

    public static void main(String[] args) {
        int[] nums={1,3,5,6};
        int i = searchInsert(nums, 7);
        System.out.println(i);

    }
}
